package edu.ctbu.ctbujsj.controller;


import edu.ctbu.ctbujsj.domain.Student;
import edu.ctbu.ctbujsj.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Optional;

@RestController
@Slf4j
public class HelloController {


    @Autowired
    private StudentService studentService;

    @RequestMapping(value = "/hello")
     public String sayHi(){


        log.debug("这是debug.. ");
        log.info("这是info.....");

        log.error("这是出错了....");
         return "hello,spring boot";


     }


     @PostMapping("findById/{id}")
     public Optional<Student> findById(@PathVariable Long id){
        return studentService.findById(id);
     }

}
